///////////////////////////////////////////////////////////////////////////////
///                                                                         ///
/// <TR069.h> - TR069 module.                                               ///
///                                                                         ///
/// Version :        0.0.2                                                  ///
/// Language :       C                                                      ///
/// Platform :       Linux                                                  ///
/// Application :    TR069                                                  ///
/// Author :         Ireta                                                  ///
/// Created Date :   2012_07_01                                             ///
/// Header :                                                                ///
///                                                                         ///
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
///                           Maintenance                                   ///
///////////////////////////////////////////////////////////////////////////////

/*
 Version  Modified By  Date        Remarks
 =============================================================================
 0.0.2    Ireta        2014-09-30  Add OSUtils_forceKillProcess().
 */

#ifndef OS_UTILS_H
#define OS_UTILS_H

#include <stdbool.h>

enum FILE_OPERATION_TYPE {
    FOT_SINGLE,		// signal file or dir
    FOT_FILES, 		// files in dir, but no dir
    FOT_ALL			// all things in dir
};

bool  OSUtils_executeCommand(const char* command);
bool  OSUtils_executeCommandWithResult(const char* command, char* result, int resultSize);
char* OSUtils_executeCommandAndCheck(const char command[], const char targetString[], char* result, int resultSize);
bool  OSUtils_isFileExisted(const char* path);
int   OSUtils_getProcessIDByName(const char* fileName);
bool  OSUtils_isProcessExisted(const char* name);
int   OSUtils_killProcess(const char* name, int pid);
int   OSUtils_killProcessByPID(const char* pid);
int   OSUtils_forceKillProcess(const char* name, int pid);
int   OSUtils_copy(enum FILE_OPERATION_TYPE type, const char* source, const char* destination);
int   OSUtils_remove(enum FILE_OPERATION_TYPE type, const char* path);
bool  OSUtils_mkdir(const char* path);
int   OSUtils_chmod(enum FILE_OPERATION_TYPE type, int mode, const char* path);

#endif // OS_UTILS_H
